//
//  LogininViewController.swift
//  Monosaccharides
//
//  Created by iSolar on 2017/10/10.
//  Copyright © 2017年 nothing. All rights reserved.
//

import UIKit

class LogininViewController: BaseViewController , UITextFieldDelegate{

    @IBOutlet weak var bgView: UIImageView!
    
    @IBOutlet weak var accountView: UIView!
    
    @IBOutlet weak var numLabel: UITextField!
    
    @IBOutlet weak var accountLabel: UILabel!
    
    @IBOutlet weak var pwdLabel: UILabel!
    
    @IBOutlet weak var inputLabel: UITextField!
    
    @IBOutlet weak var forgetPWD: UIButton!
    
    @IBOutlet weak var registerBtn: UIButton!
    
    @IBOutlet weak var loginBtn: UIButton!
    
    @IBOutlet weak var thirdLabel: UILabel!
    
    @IBOutlet weak var lineView: UIView!
    
    @IBOutlet weak var lineView2: UIView!
    
    @IBOutlet weak var qqLoginBtn: UIButton!
    
    @IBOutlet weak var wechatBtn: UIButton!
    
    @IBOutlet weak var sinaBtn: UIButton!
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        forgetPWD.tag = 11
        
        registerBtn.tag = 12
        
        loginBtn.tag = 13
        
        qqLoginBtn.tag = 14
        
        wechatBtn.tag = 15
        
        wechatBtn.tag = 16
        
        self.title = "登录"
        
        self.setupNaviBarButtonItem()
        
    }
    
    @IBAction func thirdLogin(_ sender: UIButton) {
        
        switch sender.tag {
        case 14:
            
            break
        case 15:
            
            break
        case 16:
            
            break
        default:
            break
        }
        
    }
    
    
    @IBAction func forgetPWDAndRegisterAndLogin(_ sender: UIButton) {
        
        switch sender.tag {
        case 11:
            
            let registerVC = ForgetPWDViewController()
            registerVC.title = "忘记密码"
            navigationController?.pushViewController(registerVC, animated: true)
            
            break
        case 12:
            
            let registerVC = NewRegisterViewController()
            registerVC.title = "注册"
            navigationController?.pushViewController(registerVC, animated: true)
            
            break
        case 13:
            
            break
        default:
            break
        }
        
    }
    
    func textFieldShouldReturn(_ textField: UITextField) -> Bool {
        
        textField.resignFirstResponder()
        
        return true
    }
}

extension LogininViewController {
    
    func setupNaviBarButtonItem() {
        
        navigationItem.leftBarButtonItem = UIBarButtonItem.init(title: "取消", style: .plain, target: self, action: #selector(cancelButtonClick))
        
    }
    
    func cancelButtonClick() {
        dismiss(animated: true) {
            
        }
    }
    
}
